package com.member.shop.service.impl;

import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import com.member.common.utils.DateUtils;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;
import com.member.shop.mapper.SysBizWriteOffMapper;
import com.member.shop.domain.SysBizWriteOff;
import com.member.shop.service.ISysBizWriteOffService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 核销Service业务层处理
 *
 * @author lixinchen
 * @date 2024-11-05
 */
@Service
public class SysBizWriteOffServiceImpl extends ServiceImpl<SysBizWriteOffMapper, SysBizWriteOff> implements ISysBizWriteOffService {
    @Resource
    private SysBizWriteOffMapper sysBizWriteOffMapper;

    /**
     * 查询核销
     *
     * @param id 核销主键
     * @return 核销
     */
    @Override
    public SysBizWriteOff selectSysBizWriteOffById(Long id) {
        return sysBizWriteOffMapper.selectById(id);
    }

    /**
     * 查询核销列表
     *
     * @param queryWrapper 核销
     * @return 核销
     */
    @Override
    public List<SysBizWriteOff> selectSysBizWriteOffList(LambdaQueryWrapper<SysBizWriteOff> queryWrapper) {
        return sysBizWriteOffMapper.selectList(queryWrapper);
    }

    @Override
    public List<SysBizWriteOff> selectSysBizWriteOffList(SysBizWriteOff sysBizWriteOff) {
        return sysBizWriteOffMapper.selectSysBizWriteOffList(sysBizWriteOff);
    }

    /**
     * 新增核销
     *
     * @param sysBizWriteOff 核销
     * @return 结果
     */
    @Override
    public int insertSysBizWriteOff(SysBizWriteOff sysBizWriteOff) {
        sysBizWriteOff.setCreateTime(DateUtils.getNowDate());
        return sysBizWriteOffMapper.insert(sysBizWriteOff);
    }

    /**
     * 修改核销
     *
     * @param sysBizWriteOff 核销
     * @return 结果
     */
    @Override
    public int updateSysBizWriteOff(SysBizWriteOff sysBizWriteOff) {
        sysBizWriteOff.setUpdateTime(DateUtils.getNowDate());
        return sysBizWriteOffMapper.updateById(sysBizWriteOff);
    }

    /**
     * 批量删除核销
     *
     * @param ids 需要删除的核销主键
     * @return 结果
     */
    @Override
    public int deleteSysBizWriteOffByIds(Long[] ids) {
        return sysBizWriteOffMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除核销信息
     *
     * @param id 核销主键
     * @return 结果
     */
    @Override
    public int deleteSysBizWriteOffById(Long id) {
        return sysBizWriteOffMapper.deleteById(id);
    }

}
